package com.xjcs.saplingplan.utils

import java.text.SimpleDateFormat
import java.util.Locale

object TimeUtils {

    private const val FORMAT_STANDARD = "yyyy-MM-dd HH:mm:ss"
    const val FORMAT_YMD = "yyyy-MM-dd"
    const val FORMAT_YMD_TEXT = "yyyy年MM月dd日"
    const val FORMAT_MD = "MM-dd"
    const val FORMAT_MD_TEXT = "MM月dd日"
    const val FORMAT_D = "dd"
    const val DAY_MILLIS = 86400000

    fun formatDate(timeInMillis: Long, formatPattern: String = FORMAT_STANDARD): String {
        val sdf = SimpleDateFormat(formatPattern, Locale.getDefault())
        return sdf.format(timeInMillis)
    }
}